<?php

namespace IMooc;

/**
 * 注册树模式
 */
class Register
{
    protected static array $objects = [];

    static function set(string $alias, mixed $object): void
    {
        self::$objects[$alias] = $object;
    }

    static function get(string $name)
    {
        return self::$objects[$name] ?? null;
    }

    static function _unset(string $alias): void
    {
        unset(self::$objects[$alias]);
    }
}